<link rel="stylesheet" href="/NewAdmin/css/app.v1.css" />
<link rel="stylesheet" type="text/css" href="/Store/css/WdatePicker/skin/WdatePicker.css" />
<script src="/Store/css/WdatePicker/WdatePicker.js" type="text/javascript" charset="utf-8"></script>
<div class="main-content">

	<section class="scrollable wrapper">
		<!-- 操作提示  start -->
	
		<form action="{:U('Mall/index')}" method="get">
		
		<div class="row padder-v">
			<div class="col-sm-9" style="width:5%;"></div>
			<div class="col-sm-2">
				<input type="text" name="oreder_name"value="{$_GET['oreder_name']}" class="input-sm form-control" placeholder="请输入订单号">
			</div>
			<input type="text" name="startDate" placeholder="请选择开始日期"  value="{$_GET['startDate']}" class="input-medium" style="float:left;width:203px;margin-right:5px;padding:5px 10px;height:30px;border:1px solid #d9d9d9;" onclick="WdatePicker()">
			<input type="text" name="endDate" placeholder="请选择结束日期" value="{$_GET['endDate']}" class="input-medium" style="float:left;width:203px;margin-right:5px;padding:5px 10px;height:30px;border:1px solid #d9d9d9;" onclick="WdatePicker()">
			<div style="width: 35%;float: left;">
				<div style="width:59px;float:left;line-height: 30px;">订单状态</div>
				<select style="width: 20%;height: 30px;border-color: #d9d9d9;" name="order_status">
					<option value="">全部</option>
					<option value="10" <eq name="_GET['order_status']" value='10'>selected</eq>>待付款</option>  
					<option value="20" <eq name="_GET['order_status']" value='20'>selected</eq>>待发货</option>
					<option value="30" <eq name="_GET['order_status']" value='30'>selected</eq>>待收货</option>
					<option value="40" <eq name="_GET['order_status']" value='40'>selected</eq>>已收货</option>
					<option value="0" <eq name="_GET['order_status']" value='0'>selected</eq>>已关闭</option>
					<option value="-1" <eq name="_GET['order_status']" value='-1'>selected</eq>>退款中</option>
					<option value="-2" <eq name="_GET['order_status']" value='-2'>selected</eq>>已退款</option>
				</select>
				<select  name="province" id="seleAreaNext" onchange="getProvince(this,'#seleAreaThird')"style="width: 20%;height: 30px;border-color: #d9d9d9;">
					<option value="">请选择省</option>
				</select>


				<select  name="city" id="seleAreaThird" onchange="getSelCity(this, '#seleAreaFouth')" style="width: 20%;height: 30px;border-color: #d9d9d9;">
					<option value="">请选择市</option>
				</select>


				<select  name="district" id="seleAreaFouth" style="width: 20%;height: 30px;border-color: #d9d9d9;">
					<option value="-1">请选择区</option>
				</select>
			</div>
			<div class="col-sm-1">
				<button class="btn btn-sm btn-default" type="submit" >搜索</button>
			</div>
		</div>
			
		</form>
		<input type="hidden" id="company_province_id" value="{$_GET['province']}">
		<input type="hidden" id="company_city_id" value="{$_GET['city']}">
		<input type="hidden" id="company_district_id" value="{$_GET['district']}">
		<section class="panel panel-default">
			
			<table class="table table-striped b-t b-light text-sm">
				<thead>
					<tr>
						<th width="20"><input type="checkbox"></th>
						<th>订单编号</th>
						<th>店铺</th>
						<th>买家</th>
						<th>下单时间</th>
						<th>订单总额</th>
						<th>订单状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody id="list">
					<foreach name="order_list" item="v">
					<tr>
						<td><input type="checkbox" name="sub" value="undefined"></td>
						<td>{$v.order_sn}</td>
						<td>{$v.store_name}</td>
						<td>{$v.buyer_name}</td>
						<td>{:date('Y-m-d H:i:s',$v['add_time'])}</td>
						<td>￥ {$v.order_amount}</td>
						<php>
										if($v['tuanselect']==1){
											if($v['tuan_is_first_id']==0){
												$num=get_tuan($v['order_id']);
											}else{
												$num=get_tuan($v['tuan_is_first_id']);
											}
											
										}
									</php>
						<td>
							<eq name="v['refund_state']" value="0">
								<eq name="v['order_state']" value="0">
									已取消
								</eq>
								<eq name="v['order_state']" value="10">
									等待买家付款
								</eq>
								<eq name="v['order_state']" value="20">
									<php>if($v['tuanselect']==1&&$num<$v['tuannum']){</php>
										拼团中
									<php>}elseif($v['tuanselect']==1&&$num==$v['tuannum']){</php>
										拼团成功<br/>等待卖家发货
									<php>}else{</php>
										等待卖家发货
									<php>}</php>
									
								</eq>
								<eq name="v['order_state']" value="30">
									等待买家收货
								</eq>
								<eq name="v['order_state']" value="40">
									待评价
								</eq>
							</eq>
							<gt name="v['refund_state']" value="0">
								<eq name="v['refund_state']" value="1">
									退款,待审核
								</eq>
								<eq name="v['refund_state']" value="2">
									已同意
									<notempty name="v['refund_shipping_code']">
									<br>买家已发货
									</notempty>
									
								</eq>
								<eq name="v['refund_state']" value="3">
									已拒绝退款
								</eq>
								<eq name="v['refund_state']" value="4">
									等待客服打款
								</eq>
								<eq name="v['refund_state']" value="5">
									退换货完成
								</eq>
							
								<eq name="v['refund_type']" value="1"><br/>(我要退款，但不退货)</eq>
								<eq name="v['refund_type']" value="2"><br/>(我要退款，退货)</eq>
							</gt>
						</td>
						<td>
							<a href="{:U('Mall/orderdetail',array('id'=>$v['order_id']))}">查看</a>
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
		
			<style type="text/css">
				.pagination{}
				.pagination a{display: block;float: left;border-bottom-left-radius: 3px;border-top-left-radius: 3px;padding: 5px 10px;font-size: 12px;font-weight: 500;border-radius: 2px;}
				.pagination span{display: block;float: left;border-bottom-left-radius: 3px;border-top-left-radius: 3px;background-color: #fafafa;border: 1px solid #dddddd;padding: 5px 10px;font-size: 12px;font-weight: 500;border-radius: 2px;}
			</style>
			<footer class="panel-footer">
				<div class="row" id="page">

					<div class="col-sm-4 text-center">
						<small class="text-muted inline m-tb-8">总计 <span id="total_count_num">{$count}</span>个记录</small>有效订单消费金额：￥{$count_price}  &nbsp;&nbsp; <em style="color:red;font-style: normal">注：(有效订单指已付款未退换货订单)</em>
					</div>
					<div class="col-sm-5 text-right text-center-xs">
						<ul class="pagination pagination-sm m-t-none m-b-none">
							{$page}
						</ul>
					</div>
					
				</div>
			</footer>

		</section>

	</section>
</div>
<script src="/Partner/static/js/jquery.min.js?v=2.1.4"></script>
<script src="/NewAdmin/js/init_address.js"></script>
<script type="text/javascript">

    $(function() {
        if($("#company_province_id").val() == null) {
            provice_id = 0;
        } else {
            provice_id = $("#company_province_id").val();
        }
        if($("#company_city_id").val() == null) {
            city_id = -1;
        } else {
            city_id = $("#company_city_id").val();
        }
        if($("#company_district_id").val() == null) {
            district_id = -1;
        } else {
            district_id = $("#company_district_id").val();
        }

        if(provice_id == 0) {
            initProvince('#seleAreaNext');
        } else {
            load('province', provice_id, 'city', city_id, 'district', district_id);
        }



    });
</script>
